package dnd.view
{
	import dnd.extension.base.*;
	import dnd.extension.data.SubtitleItem;
	import dnd.model.*;
	import flash.text.TextField;
	import com.greensock.*;
	
	/**
	 * ...
	 * @author Hugh Hoang
	 */
	public class SlideView extends ViewBase
	{
		public function SlideView(model:SlideModel)
		{
			var yPos:Number = 10;
			for each (var sub:SubtitleItem in model.subtitleCollection)
			{
				var txtGreeting:TextField = new TextField();
				addChild(txtGreeting);
				txtGreeting.defaultTextFormat = DefaultFontFormat(24);
				txtGreeting.text = sub.text + ":" + sub.timeStart;
				txtGreeting.embedFonts = true;
				txtGreeting.x = 10;
				txtGreeting.y = yPos;
				txtGreeting.autoSize = "left";
				txtGreeting.selectable = false;
				txtGreeting.alpha = 0;
				
				timeLine.insert(TweenMax.to(txtGreeting, sub.timeEnd - sub.timeStart, {alpha: 1, yoyo: true, repeat: 1}), sub.timeStart);
				
				yPos += 60;
			}
		}
	}
}